<template>
  <div :class="[`nav-theme-${navTheme}`, `nav-layout-${navLayout}`]">
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider
        v-if="navLayout === 'left'"
        v-model="collapsed"
        :trigger="null"
        collapsible
        :theme="navTheme"
        width="256px"
      >
        <div style="text-align: center">
          <img src="../assets/logo-big.png" class="logo" alt="logo" />
          <div class="logo">一起走</div>
        </div>

        <SiderMenu
          :theme="navTheme"
          :menuLayout="navLayout === 'left' ? 'inline' : 'horizontal'"
          :layoutCollapsed="collapsed"
        />
      </a-layout-sider>
      <a-layout>
        <a-layout-header
          :style="
            navLayout === 'left'
              ? 'background: #fff; padding: 0'
              : navTheme === 'dark'
              ? 'background: #001529; padding: 0'
              : 'background: #fff; padding: 0'
          "
        >
          <a-icon
            v-if="navLayout === 'left'"
            class="trigger"
            :type="collapsed ? 'menu-unfold' : 'menu-fold'"
            @click="collapsed = !collapsed"
          ></a-icon>
          <!-- <Header /> -->
          <SiderMenu
            v-if="navLayout !== 'left'"
            :theme="navTheme"
            :menuLayout="navLayout === 'left' ? 'inline' : 'horizontal'"
            :layoutCollapsed="collapsed"
            style="display: inline-block"
          />
          <right-content
            :top-menu="settings.layout === 'topmenu'"
            :is-mobile="isMobile"
            :theme="navTheme"
            :navLayout="navLayout"
            style="float: right"
          />
        </a-layout-header>
        <a-layout-content style="margin: 0 16px">
          <router-view></router-view>
        </a-layout-content>
        <a-layout-footer style="text-align: center">
          <Footer />
        </a-layout-footer>
      </a-layout>
    </a-layout>
    <SettingDrawer />
  </div>
</template>

<script>
import RightContent from "../components/BasiclayoutHeader/RightContent";
// import Header from "./Header";
import Footer from "./Footer";
import SiderMenu from "./SiderMenu";
import SettingDrawer from "../components/SettingDrawer";
import defaultSettings from "@/config/defaultSettings";

export default {
  name: "BasicLayout",
  components: {
    RightContent,
    // Header,
    Footer,
    SiderMenu,
    SettingDrawer,
  },
  computed: {
    navTheme() {
      return this.$route.query.navTheme || "dark";
    },
    navLayout() {
      return this.$route.query.navLayout || "left";
    },
  },
  data() {
    return {
      collapsed: false, // 控制左侧菜单收缩
      settings: {
        // 布局类型
        layout: defaultSettings.layout, // 'sidemenu', 'topmenu'
        // 定宽: true / 流式: false
        contentWidth:
          defaultSettings.layout === "sidemenu"
            ? false
            : defaultSettings.contentWidth === "Fixed",
        // 主题 'dark' | 'light'
        theme: defaultSettings.navTheme,
        // 主色调
        primaryColor: defaultSettings.primaryColor,
        fixedHeader: defaultSettings.fixedHeader,
        fixSiderbar: defaultSettings.fixSiderbar,
        colorWeak: defaultSettings.colorWeak,

        hideHintAlert: false,
        hideCopyButton: false,
      },
      // 是否手机模式
      isMobile: false,
    };
  },
};
</script>

<style scoped>
.trigger {
  padding: 0 20px;
  line-height: 64px;
  font-size: 20px;
}
.trigger:hover {
  background: #eeeeee;
}
.logo {
  height: 55px;
  line-height: 64px;
  text-align: center;
  display: inline;
  overflow: hidden;
}
.nav-theme-dark >>> .logo {
  color: #ffffff;
}
</style>
